home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
DiskUtil
/
Misc
/
BTNTape
/
doc
/
drives.doc
next >
Wrap
Text File
|
1994-04-03
|
7KB
|
149 lines
This section of the BTN documentation gives some background information
about how tape drives work. If you already know you may want to skip it.
**** BTNtape: an AmigaDOS handler for SCSI tape drives
**** Version 3.0 3/14/94
**** Freeware by Bob Rethemeyer (drBob@cup.portal.com)
**** (c) Copyright 1990, 1994 Robert Rethemeyer.
There are essentially two types of SCSI tape drives supported by BTNtape:
SEQUENTIAL and DIRECT-ACCESS. The sequential type is the far more common,
but occasionally the direct-access drives can be gotten cheaply.
Although some manufacturers of tape drives may support some additional
fancy commands, BTNtape does not make use of them. It caters to the
lowest common denominator of tape drive, to ensure maximum compatibility
and reduce the complexity of the code.
A note about terminology. I will use the term "tapefile" to refer to
a file stored on a tape, to distinguish it from an AmigaDOS file.
A tapefile may be a TAR archive containing multiple AmigaDOS files;
in this sense it is sometimes called a "backup set".
BLOCKS
The speed of tape drives requires that data bytes be written in groups,
called blocks. Tape drives may be capable of two modes of blocking
bytes: variable block mode and fixed block mode. Most drives have
only fixed mode, but some (especially newer) drives can do both.
BTN always operates drives in fixed block mode.
Variable block mode means that each block may be a different, arbitrary
size than other blocks in the tapefile. Not all tape drives are
capable of this mode, and in any case BTNtape does not support it.
Fixed block mode means that every block in a tapefile is exactly
the same number of bytes. Most fixed block drives have a block
size which cannot be changed, but other (again newer) drives will
allow you to specify the fixed block size, within a certain range.
What does this mean to you? A couple things.
First, if a tape was written with a certain block size, you must read
it using the same block size. If your drive can't do that block size,
you are out of luck for that tape.
Second, the size of all tapefiles is rounded up to the nearest
block size boundary. So if your drive block size is 512 bytes and you
want to write an 800 byte file, it is stored on the tape as 1024 bytes.
When you read it back you will get 1024 bytes with the last 244 bytes
padded with extraneous zeroes. For this reason it is unwise to store
in tapefiles raw AmigaDOS executable files, which must be an exact size.
Instead use TAR to create an archive to contain the file(s).
Most tape drives are more efficient if you write more than just one
block at a time, because usually a gap is created after each write
operation. This gap is essentially wasted tape, so it is better to
keep the ratio of gaps to blocks small. BTNtape is capable of collecting
multiple blocks of data before initiating a write. For example, if
your block size is 512 bytes, you can specify (using the "NB" parameter)
that BTN write in groups of, say 256 blocks (131072 bytes). This way
there will be a gap every 131072 bytes instead of every 512 bytes.
SEQUENTIAL DRIVES
As the name implies, data on a sequential tape drive can only be
read or written in consecutive blocks, the natural mode of accessing
an inherently sequential medium. The tape head is positioned at
a single point on a long noodle of tape. The natural direction of
movement of the tape is forward. The drive cannot read or write
backwards, but it can rewind or fast-forward the tape to position
the head at a point in anticipation of reading or writing.
The data on a tape can be viewed as follows:
BOT/---TF0---/FM/---TF1---/FM/---TFn---/FM/--BLANK--/--INACCESSIBLE--/EOT
BOT is the beginning of the tape, the point you get to after a rewind.
This is sometimes called the load point.
TF0, TF1, etc. are the tapefiles, as many and as large as you can
fit on the tape.
FM is a filemark, a special marker placed to separate tapefiles.
BTN automatically writes a filemark when it finishes writing a tapefile.
BLANK is the area following the last filemark on the tape. Most
tape drives seem to erase the tape just ahead of where it is currently
writing, so the drive can later easily find the next available write area.
The area beyond the blank spot cannot be read by most tape drives,
but of course it can be written over as you write more data to the tape.
When the tape becomes full or you have read to the end of a full tape,
the EOT (end of tape) marker is hit. This will result in a special
status being returned to the system so that it may take special action.
[BTN does not currently deal with EOT very well, try to avoid it.]
Most tape drives enforce special restrictions on how you can access
the data on a tape. Please note that these restrictions are imposed
by the drive, and that BTN must honor them.
WRITES: you may write data at the beginning of the tape, or at the
end of the last-written data starting at the blank spot. You may
not write in the middle of the tape and expect the subsequent data
to be preserved. For example, if you have 5 existing tapefiles and you
want to rewrite the 3rd, the 4th and 5th files are effectively destroyed.
Thus BTN supports only writing to the beginning of the tape (which makes
all previous files on the tape inaccessible), or appending a new file
to the end of the existing files (just after the last filemark).
If you append a file when not already at the blank spot, the tape
is rewound then fast-forward is used to get to the blank spot.
READS: you may read only existing files on the tape before the blank spot.
You cannot read past the blank spot to get old files that used to be there.
If you ask to read a file in the middle of the tape, the drive will
fast-forward to that file before starting to read. If you are already
in the middle of the tape positioned ready to read the next tapefile
in the sequence, no additional tape movement is necessary, and reading
begins immediately. But if you want to read a file out of sequence,
it must rewind to the beginning and fast-forward again.
DIRECT-ACCESS DRIVES
From a programming point of view, a direct-access (DA) drive looks more
like a disk drive than a sequential device. But physically, it is
still a sequential tape drive. The onboard controller of the DA drive
handles all tape movement to make any point on the tape accessible
in any order, albeit with a substantial delay.
The tapes used with DA drives must be formatted into fixed-sized
numbered blocks, like a disk drive. You can then read or write
a block address anywhere on the tape, and the drive will proceed
to spin its little brains out to position the tape to that block.
BTNtape does not make use of the random access aspect of DA drives.
It writes tapefiles by starting at a block number and incrementing
the block number for subsequent blocks.
DA drives do not have filemarks, so if there is more than one tapefile,
they must be kept separate by you keeping track of their starting
block numbers to avoid overlapping them.